var modZErrorMsg_locLang=new localLang("modZErrorMsg");
var modZErrorMsg = new Class({
	Extends:WFWindow,
	sampleProxyEnable: false,	
    options: {
        name: 'modZErrorMsg',
        title: modZErrorMsg_locLang.label('title'),
        btnSettings: true,
        btnRefresh: true,
        btnHelp: true,
        btnClose: true,
        loadCSS: true,
        serverSetting: true,
		supportServerTypes:['modSimple']
    },

    settingModalOption:{
        title: modZErrorMsg_locLang.label('edit') + ' - '+ modZErrorMsg_locLang.label('title'),
        content: '<input type="button" class="cancel" value="'+modZErrorMsg_locLang.label('btn_cancel')+'">',
        callBack: function(){
            $$('.modalContent .cancel').addEvent('click',function(e){
                this.refreshMod();
                this.settingModal.close();
            }.bind(this));
        }
    },
    renderContent: function(){
        this.errormsg = new Element('div',{'class':'error'}).inject(this.boxBD);
        this.msg = new WFMessage(this.errormsg);
        var option = {
            type: '0', //0: error, 1: warn, 2: info
            description: 'aaa', //text
            button: 'aaa', //string
            callback: function(){alert('1');}, //callback function
            close: true //true or false      
        };
        var option2 = {
            type: '1', //0: error, 1: warn, 2: info
            description: 'bbb', //text
            button: 'bbb', //string
            callback: function(){alert('2');}, //callback function
            close: true //true or false        
        };
        var option3 = {
            type: '2', //0: error, 1: warn, 2: info
            description: 'ccc', //text
            button: 'ccc', //string
            callback: function(){alert('3');}, //callback function
            close: true //true or false        
        };
        this.input = new Element('input', {type:'button',value:'Widget error'}).injectInside(this.boxBD);
        this.input.addEvent('click',function(e){
            this.msg.fireEvent('message',option);
            window.fireEvent('widget_load', this.widgetInfo);
        }.bind(this));
        this.input2 = new Element('input', {type:'button',value:'Widget warning'}).injectInside(this.boxBD);
        this.input2.addEvent('click',function(e){
            this.msg.fireEvent('message',option2);
            window.fireEvent('widget_load', this.widgetInfo);
        }.bind(this));
        this.input3 = new Element('input', {type:'button',value:'Widget info'}).injectInside(this.boxBD);
        this.input3.addEvent('click',function(e){
            this.msg.fireEvent('message',option3);
            window.fireEvent('widget_load', this.widgetInfo);
        }.bind(this));

        this.input4 = new Element('input', {type:'button',value:'WF error'}).injectInside(this.boxBD);
        this.input4.addEvent('click',function(e){
            wfc_message.fireEvent('message',option);
        }.bind(this));
        this.input5 = new Element('input', {type:'button',value:'WF warning'}).injectInside(this.boxBD);
        this.input5.addEvent('click',function(e){
            wfc_message.fireEvent('message',option2);
        }.bind(this));
        this.input6 = new Element('input', {type:'button',value:'WF info'}).injectInside(this.boxBD);
        this.input6.addEvent('click',function(e){
            wfc_message.fireEvent('message',option3);
        }.bind(this));
        window.fireEvent('widget_load', this.widgetInfo);
    },
	onClickRefresh2: function(){
		var option = {
			title: 'customize button',
			content: '<input type="button" class="cancel" value="'+modZErrorMsg_locLang.label('btn_cancel')+'">',
			callBack: function(){
				$$('.modalContent .cancel').addEvent('click',function(e){
					this.customButtonModal.close();
				}.bind(this));
			}.bind(this)
		};
		this.customButtonModal = new WFModal(option);
	},
    onContentresize: function(event){
        this.refreshMod();
    },
    refreshMod:function(){
        //var xy = this.getContentSize();
        //this.renderChart(xy.x, xy.y-this.errormsg.getSize().y);
        //need to fire widget_load event if it change widget's height
        //window.fireEvent('widget_load');
    }
});
